/**
 * ____________________ *
 *  ____ ____ ____ _  _ *
 *  |___ [__] |--< |\/| *
 * ____________________ *
 *
 * THE CORM PROJECT
 *
 * This file may only be used in accordance with the
 * terms of the Academic Free License ("AFL") v. 3.0,
 * as published by the Open Software Initiative.  A
 * copy of this license is provided in this source
 * release, and may be viewed online at:
 *
 * (http://www.opensource.org/licenses/afl-3.0.php)
 */
package org.eremite.corm.party;

import org.eremite.corm.BaseArchetype;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

@Entity
public class BindingType extends BaseArchetype {

    @OneToMany(cascade={
            CascadeType.PERSIST,
            CascadeType.MERGE})
    private Set <BindingValue> options = new HashSet<BindingValue> ();

    public BindingType() {}

    public BindingType(String name) {
        setName(name);
    }

    public Set<BindingValue> getOptions() {
        return options;
    }

    public void setOptions(Set<BindingValue> options) {
        this.options = options;
    }

    public void addOption(BindingValue option) {
        getOptions().add(option);
    }

    public void addOption(BindingValue... options) {
        getOptions().addAll(java.util.Arrays.asList(options));
    }
}